<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 判断两个数是否为亲密数
        function isqinmishu(a,b) {
            var sum1 = 0;
            var sum2 = 0;
            for (var i = 1; i < a; i++){
                if (a % i == 0){
                    sum1 += i;
                }
            }
            for (var j = 1; j < b; j++){
                if (b % j == 0){
                    sum2 += j;
                }
            }
            if (sum1 == b && sum2 == a) {
                return console.log(a + "和" + b + "是一对亲密数");
            }
        }
        
        // 循环遍历2000以内的数是否为亲密数
        for (var i = 1; i <= 2000; i++) {
            for (var j = 2000; j > i; j--) {
                isqinmishu(i,j)
            }
        }
    </script>
</head>
<body>
    
</body>
</html>